home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dialog / vbmb15 / ctl3d.bas next >
Encoding:
BASIC Source File  |  1994-10-14  |  3.0 KB  |  59 lines

  1. '------------------------------------------------------------------------ΒΌ
  2. 'This module is used to give three dimensional effects to message boxes, |
  3. 'input boxes, and common dialogs.  Its use is simple:                    |
  4. '                                                                        |
  5. 'To begin 3D effects use StartApp3D.  Its use is: StartApp3D.  This      |
  6. 'regesters your app with CTL3DV2.dll.  Before you end your application   |
  7. 'you must unregester your app.  In the form's unload event place the     |
  8. 'EndApp3D command.  Its use is:  EndApp3D.  If your application ends     |
  9. 'without unregestering an error will occure.  This error will end VB if  |
  10. 'your in the VB environment.  It may also end windows.  I have many      |
  11. 'errors with CTL3D (versons 1 and 2) as well as this module, I can take  |
  12. 'no responcibility - *USE AT YOUR OWN RISK*.                             |
  13. '                                                                        |
  14. 'This module uses CTL3DV2.DLL which must be located in the System        |
  15. 'directory.  Remember *USE AT YOUR OWN RISK*  This module may still      |
  16. 'contain bugs (I've tried to rid it of them).  *USE AT YOUR OWN RISK*    |
  17. '*USE AT YOUR OWN RISK* *USE AT YOUR OWN RISK* *USE AT YOUR OWN RISK*    |
  18. '-------------------------------------------------------------------------
  19.  
  20. ' 94/08/06 Minor changes made by Larry Rebich, The Bridge, Inc.
  21.  
  22.     Option Explicit
  23.     DefInt A-Z
  24. '    Declare Sub ShellAbout Lib "SHELL.DLL" (ByVal hWnd, ByVal AppName$, ByVal AppInfo$, ByVal hIcon)
  25.     Declare Function GetWindowWord Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Integer
  26.     Declare Function Ctl3DAutoSubclass Lib "Ctl3Dv2.DLL" (ByVal hInst As Integer) As Integer
  27.     Declare Function Ctl3DRegister Lib "Ctl3Dv2.DLL" (ByVal hInst As Integer) As Integer
  28.     Declare Function Ctl3DUnregister Lib "Ctl3Dv2.DLL" (ByVal hInst As Integer) As Integer
  29.     
  30.     Const GWW_HINSTANCE = (-6)
  31.  
  32. Sub EndApp3D ()
  33.     Rem This Sub is used to end the 3D effects
  34.     Rem IMPORTANT: you must end 3D effects before your app ends
  35.     Dim inst, ret
  36.     inst = GetWindowWord(Forms(0).hWnd, GWW_HINSTANCE) 'Get the Word of Frm
  37.     ret = Ctl3DUnregister(inst)     ' Unregister the program.
  38. End Sub
  39.  
  40. Sub StartApp3D ()
  41.     Rem Use this to start the 3D dialogs
  42.     If Forms.Count = 0 Then
  43.         Dim Msg As String
  44.         Msg = "There is no loaded form.  "
  45.         Msg = Msg & "To register your app with CTL3DV2 "
  46.         Msg = Msg & "there must be at least one loaded form.  "
  47.         Msg = Msg & Chr$(13) & Chr$(13)
  48.         Msg = Msg & "Use the Load statement to load a form, "
  49.         Msg = Msg & "use StartApp3D, then unload the form."
  50.         MsgBox Msg, 48, "No Form Loaded"
  51.         Exit Sub
  52.     End If
  53.     Dim inst, ret
  54.     inst = GetWindowWord(Forms(0).hWnd, GWW_HINSTANCE)  'Get the Word from Frm
  55.     ret = Ctl3DRegister(inst)       ' Register program w/ Ctl3d.
  56.     ret = Ctl3DAutoSubclass(inst)   ' Subclass the program.
  57. End Sub
  58.  
  59.